//
//  UIButton+QKButton.m
//  QKWeibo-OC
//
//  Created by iMac_Kurt on 16/8/12.
//  Copyright © 2016年 Kurt_Qi. All rights reserved.
//

#import "UIButton+QKButton.h"

@implementation UIButton (QKButton)
/// 快速创建按钮
///
/// @param title      文字
/// @param titleColor 文字颜色
/// @param backName   背景图片名
///
/// @return UIButton
+ (instancetype)buttonWithTitle:(NSString *)title color:(UIColor *)titleColor backgroundImageName:(NSString *)backName {
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:backName] forState:UIControlStateNormal];
    
    return button;
}

/// 快速创建按钮
///
/// @param title      文字
/// @param titleColor 文字颜色
/// @param fontSize   字体大小
/// @param name       图片名
///
/// @return UIButton
+ (instancetype)buttonWithTitle:(NSString *)title color:(UIColor *)titleColor fontSize:(CGFloat)size imageName:(NSString *)name {
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:size];
    [button setImage:[UIImage imageNamed:name] forState:UIControlStateNormal];
    
    return button;
}
@end
